﻿using System;
using Xunit;

namespace Unity.Type.Tests
{
    public class EntityTypeTest
    {
        private EntityType? FoundEntityTypeEnumByValue(byte value)
        {
            switch (value)
            {
                case 0:
                    return EntityType.Unknown;
                case 1:
                    return EntityType.Order;
                case 2:
                    return EntityType.Execution;
                case 3:
                    return EntityType.Rfq;
                case 4:
                    return EntityType.Trade;
                case 5:
                    return EntityType.Position;
                case 6:
                    return EntityType.Settlement;
                case 7:
                    return EntityType.Payment;
                case 8:
                    return EntityType.Collateral;
                case 9:
                    return EntityType.Margin;
                default:
                    return null;
            }
        }

        [Fact]
        public void EnumValuesTest()
        {
            Assert.Equal(EntityType.Unknown, FoundEntityTypeEnumByValue(0));
            Assert.Equal(EntityType.Order, FoundEntityTypeEnumByValue(1));
            Assert.Equal(EntityType.Execution, FoundEntityTypeEnumByValue(2));
            Assert.Equal(EntityType.Rfq, FoundEntityTypeEnumByValue(3));
            Assert.Equal(EntityType.Trade, FoundEntityTypeEnumByValue(4));
            Assert.Equal(EntityType.Position, FoundEntityTypeEnumByValue(5));
            Assert.Equal(EntityType.Settlement, FoundEntityTypeEnumByValue(6));
            Assert.Equal(EntityType.Payment, FoundEntityTypeEnumByValue(7));
            Assert.Equal(EntityType.Collateral, FoundEntityTypeEnumByValue(8));
            Assert.Equal(EntityType.Margin, FoundEntityTypeEnumByValue(9));
            Assert.Null(FoundEntityTypeEnumByValue(Byte.MaxValue));
        }
    }
}